home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
Borland Visual dBASE Professiona v7.0
/
DATA1.CAB
/
Sample_dBASE
/
Fleet
/
reportbar.prg
< prev
next >
Wrap
Text File
|
1997-11-20
|
4KB
|
141 lines
//------------------------------------------------------------------------
//
// reportbar.prg
//
// Toolbar with report print and page navigation buttons.
// To use:
/*
f = new RepViewForm()
DO reportBar.prg WITH f, f.repView // for small buttons
DO reportBar.prg WITH f, f.repView, true // for large buttons
*/
//
// Visual dBASE Samples Group
//
// $Revision: 1.4 $
//
// Copyright (c) 1997, Borland International, Inc. All rights reserved.
//
//------------------------------------------------------------------------
parameter FormObj, repView, bLarge
local t, bNew
t = null
bNew = false
if ( PCOUNT() == 0 )
MSGBOX("To attach this toolbar to a form use: " + ;
CHR(13) + CHR(13) + ;
"DO " + PROGRAM() + " WITH <form reference>","Alert")
else
t := FindInstance("ReportToolbar")
if ( ( t == null ) or ( not FormObj.mdi ) )
SET PROCEDURE TO (PROGRAM()) ADDITIVE
t = new ReportToolbar( repView, bLarge )
bNew := true
endif
t.attach( FormObj )
endif
return ( bNew )
class ReportToolbar( repView, bLarge ) of Toolbar
local sBitsize
sBitsize = IIF( bLarge, "TL_", "TS_" )
this.repView = repView // create reference to the report viewer
this.flat := true
this.text := "Report"
this.onUpdate := class::rep_onUpdate
this.tPrint = new ToolButton( this )
with ( this.tPrint )
bitmap := "RESOURCE #857"// + sBitsize + "RPRINT"
speedTip := "Print..."
onClick := class::tPrint_onClick
endwith
this.tSep = new ToolButton( this )
with ( this.tSep )
separator := true
endwith
this.tFirst = new ToolButton( this )
with ( this.tFirst )
bitmap := "RESOURCE " + sBitsize + "RFIRST"
speedTip := "Top Page"
onClick := class::tFirst_onClick
endwith
this.tPrev = new ToolButton( this )
with ( this.tPrev )
bitmap := "RESOURCE " + sBitsize + "RPREV"
speedTip := "Previous Page"
onClick := class::tPrev_onClick
endwith
this.tNext = new ToolButton( this )
with ( this.tNext )
bitmap := "RESOURCE " + sBitsize + "RNEXT"
speedTip := "Next Page"
onClick := class::tNext_onClick
endwith
function rep_onUpdate
local bRepFound
bRepFound = ( TYPE("this.repView.ref.startPage") == "N" )
if ( bRepFound )
with ( this )
tPrint.enabled := true
tNext.enabled := ( not this.repView.ref.isLastPage() )
tFirst.enabled := ( this.repView.ref.startPage > 1 )
tPrev.enabled := ( this.repView.ref.startPage > 1 )
endwith
else
with ( this )
tPrint.enabled := false
tNext.enabled := false
tFirst.enabled := false
tPrev.enabled := false
endwith
endif
return ( bRepFound )
function tPrint_onClick
local bPrint
bPrint = CHOOSEPRINTER()
if ( bPrint )
this.parent.repView.ref.output := 1 // printer
this.parent.repView.ref.render()
this.parent.repView.ref.output := 3 // default
endif
return ( bPrint )
function tFirst_onClick
this.parent.repView.filename := this.parent.repView.filename
with ( this.parent.repView.ref )
startPage := 1
endPage := 1
endwith
return ( this.parent.repView.ref.render() )
function tPrev_onClick
local nPage, rView
rView = this.parent.repView
nPage = rView.ref.startPage
nPage--
rView.filename := rView.filename
rView.ref.startPage := nPage
rView.ref.endPage := nPage
return ( rView.ref.render() )
function tNext_onClick
with ( this.parent.repView.ref )
startPage++
endPage := this.parent.repView.ref.startPage
endwith
return ( this.parent.repView.ref.render() )
endclass